<?php


class CollectionDao {
	private  $table = 'collection';
	public function get($id){
		return ClassManager::getSql()->oneDataCache($this->table, 'id', $id);
	}
	public function add($data){
		ClassManager::getSql()->insert($this->table,$data);
	}
	public function delete($userId,$teacherId){
		ClassManager::getSql()->delete($this->table,"where user_id='".intval($userId)."'  and teacher_id='".intval($teacherId)."'");
	}
	public function searchList($where=array(),$order='',$limit=0){
		$where = $this->searchWhere($where);
		return ClassManager::getSql()->dataList1($this->table,'*',$where,$order,$limit);
	}
	public function searchWhere($where){
		$where1 = array();
		foreach ($where as  $k=>$v){
			if (!empty($v)){
				$where1[$k] = $v;
			}
		}
		return $where1;
	}
}

?>